<template>
    <div>
        <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="() => { $router.push('/login/a1') }" />
        <van-search v-model="caches" shape="round" placeholder="请输入搜索关键词" />
        <van-cell-group v-for="item in qsearch">
            <van-cell :title="item.goods_name" />
        </van-cell-group>
        <van-empty image="error" description="描述文字" />
    </div>
</template>

<script setup>
import { ref, watch } from 'vue';
import { qsearchApi } from '@/api/api'
let qsearch = ref([])
let caches = ref('')
watch(caches, (val) => {
    console.log('监听的数据', val)
    qsearchApi(val).then(res => {
        console.log('搜索', res)
        qsearch.value = res.data.message
    })
})

</script>

<style lang="scss" scoped></style>